#pragma once


class CCharOperatorState :
	public CBaseState,
	public CPlayerCharOperatorAckMsgHandler
{
protected:
	CD3DLight *						m_pLight;
	CD3DCamera *					m_pCamera;
	UINT64							m_AccountID;
	CCharListWnd *					m_pCharListWnd;
	CCharCreateWnd *				m_pCharCreateWnd;
	CD3DWOWM2Model *				m_pBackGround;

	CD3DWOWM2CharacterModel	*		m_pChar;
	float							m_CharRotation;
	UINT							m_StartX;
	UINT							m_StartY;
	bool							m_IsRotation;
	CEasyArray<CBaseCharInfo *>		m_CharInfoList;

	DECLARE_DOS_MSG_MAP_CLIENT(CCharOperatorState)
public:
	CCharOperatorState(CMainFrame * pMainFrame);
	~CCharOperatorState(void);

	virtual bool Init();
	virtual void Destory();
	virtual int Update(float Time);

	void ShowCharList(int Select);
	void StartCreateChar();	
	void CloseCreateChar();
	void CreateChar(LPCTSTR szCharName);
	void ShowChar(UINT Index);
	void ShowChar(int Race,int Sex,int SkinColor,int HairColor,int HairType,int FaceType,int BeardType);
	void ShowEmptyScene();
	CD3DWOWM2CharacterModel	* GetChar();
	void EnterGame();


	void ChangeRace(int Race);
	void ChangeGender(int Gender);
	void ChangeSkinColor(int Change);
	void ChangeHairColor(int Change);
	void ChangeFaceType(int Change);
	void ChangeHairType(int Change);
	void ChangeBeardType(int Change);

	virtual bool OnWMSG(MSG* pMsg);
protected:
	void MakeCharRotate();
protected:
	virtual int GetCharListAck(int Result ,CSmartStruct& CharData );
	virtual int CreateCharAck(int Result ,CSmartStruct& CharData );
	virtual int DeleteCharAck(int Result ,UINT64 CharID );
	virtual int SelectCharAck(int Result ,UINT64 CharID ,CSmartStruct& CharData );
};


inline CD3DWOWM2CharacterModel	* CCharOperatorState::GetChar()
{
	return m_pChar;
}